<template>
	<view v-if="user.frentLink!==5&&user!==''">
		<navbox title="发友链"></navbox>
		<view style="margin-top: 190rpx;background-color: #f9f9f9;height: 100%;">
			<view style="height: 15rpx;"></view>

			<u--textarea v-model="frent.name" placeholder="名称..." border="bottom"></u--textarea>

			<view style="background-color: #fff;margin-top: 20rpx">
				<u--textarea v-model="frent.address" placeholder="地址..." border="bottom"></u--textarea>
			</view>
			<view style="background-color: #fff;margin-top: 20rpx">
				<u--textarea v-model="frent.logo" placeholder="logo..." border="bottom"></u--textarea>
			</view>
			<view style="background-color: #fff;margin-top: 20rpx">
				<u--textarea v-model="frent.description" placeholder="简介..." border="bottom"></u--textarea>
			</view>

			<view style="margin-top: 60rpx;">
				<u-button type="primary" text="确定" @click="uploadpic()"></u-button>
			</view>
		</view>

	</view>
</template>

<script>
	import navbox from '../components/navbox/navbox.vue'
	export default {
		data() {
			return {
				user: uni.getStorageSync("user"),
				frent: {
					name: '',
					address: '',
					logo: '',
					description: ''
				}
			}
		},
		components: {
			"navbox": navbox
		},
		methods: {

			async uploadpic() {
				if (this.frent.name === null || this.frent.name === '') {
					return uni.showToast({
						title: "填写名称",
						icon: 'none'
					})
				}
				if (this.frent.address === null || this.frent.address === '') {
					return uni.showToast({
						title: "填写地址",
						icon: 'none'
					})
				}
				if (this.frent.logo === null || this.frent.logo === '') {
					return uni.showToast({
						title: "填写logo链接",
						icon: 'none'
					})
				}
				const res = await this.$myRuquest({
					url: '/wexinLogin/sgLink/addLient',
					method: 'post',
					data: this.frent
				})
				if (res.data.code === 200) {
					uni.showToast({
						title: '添加成功，等待审核通过'
					})
				}
				uni.switchTab({
					url: '/pages/index/index'
				})

			}

		}

	}
</script>

<style>

</style>
